package com.yl.auth.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yl.auth.entity.Hugong;
import com.yl.auth.entity.HugongBean;
import com.yl.auth.mapper.HugongMapper;
import com.yl.auth.service.HugongService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


/**
 * @author 王帅洋
 * @datetime 2023/6/19 9:43
 * @description 类对象
 */
@Service
public class HugongServiceImpl extends ServiceImpl<HugongMapper, HugongBean> implements HugongService {
    @Resource
    private HugongMapper huGongMapper;


    @Override
    public IPage<HugongBean> findAll(Page<HugongBean> page1, HugongBean hugongBean) {
        IPage<HugongBean> hugongBeanList = huGongMapper.findAll(page1,hugongBean);
        return hugongBeanList;
    }

    @Override
    public HugongBean getByIdhugong(Integer id) {
        Integer count=0;
        HugongBean hugongBean = huGongMapper.selectByIdHugong(id);
        if(hugongBean.getLaorencount()>0){
            count=1;
        }
        hugongBean.setCount(count);
        return hugongBean;
    }

    @Override
    public void gethugong(Hugong hugong) {
        huGongMapper.gethugong(hugong);
    }
}
